package com.zyzy.leftfourdead.adapter.groupBuyAdapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by loverforever on 2016/8/24.
 */
public class GroupBuyPageAdapter extends FragmentPagerAdapter {
    //装载碎片的集合
    private List<Fragment>list;
    //上面的标签
    private String[]secondArrTitles;

    public GroupBuyPageAdapter(FragmentManager fm,List<Fragment>list,String[]secondArrTitles) {
        super(fm);
        this.list=list;
        this.secondArrTitles=secondArrTitles;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    //获取tablayout的标签
    public CharSequence getPageTitle(int position) {
        return secondArrTitles[position];
    }
}
